const { contextBridge, ipcRenderer, remote } = require("electron");
const path = require("path");
contextBridge.exposeInMainWorld("electron", {
  getAppConfig: (key) => {
    console.log("starting read config.json");
    const configPath = path.resolve("./resources/config.json");
    const config = require("nconf").file(configPath);
    return config.get(key);
  },
  callTestDll: (a, b) => {
    console.log("starting run dll");
    const callDll = require("./main-process/modules/call-dll.js");
    return callDll.callTestDll(a, b);
  },
  openWindow: (url) => ipcRenderer.invoke("load-url", url),
  InsetJsonData: (data) => ipcRenderer.invoke("set-json", data),
  serchOptionList: (data) => ipcRenderer.invoke("set-option", data),
  getList: (data) => ipcRenderer.invoke("get-list", data),
  findPdf: (data) => ipcRenderer.invoke("find-pdf", data),
  listAllSum: () => ipcRenderer.invoke("get-totl"),
  setRemackApiFunc: (data) => ipcRenderer.invoke("set-remark", data),
});
